package javabase.enhancestring.split;

public class SplitDemo3 {

	@SuppressWarnings("unused")
	public static void main(String[] args) {
		String str = null;
		StringBuilder stringBuilder = new StringBuilder();
		for (int i = 0; i < 1000; i++) {
			stringBuilder.append(i);
			stringBuilder.append(";");
		}
		str = stringBuilder.toString();
		long lt = System.currentTimeMillis();
		for (int i = 0; i < 10000; i++) {
			while(true) {
				String splitStr = null;
				int j = str.indexOf(';');
				if (j < 0) {
					break;
				}
				splitStr = str.substring(0, j);
				str = str.substring(j + 1);
			}
		}
		System.out.println("耗时：" + (System.currentTimeMillis() - lt));
	}

}
